#pragma once
#include "com_define.h"

template<class MUTEX>
class AutoLock 
{
public:
	explicit AutoLock(MUTEX* mutex)
		:mutex_(mutex) 
	{
		MMO_ASSERT(mutex_);
		mutex_->Lock();
	}

	~AutoLock() 
	{
		MMO_ASSERT(mutex_);
		mutex_->Unlock();
	}

protected:
	MUTEX* mutex_;

protected:
	AutoLock();
	AutoLock(const AutoLock &);
	AutoLock & operator= (const AutoLock &);
};


